﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using TiaoTaoHelper.Wtm.Units.EFCore;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 用户新增Group : TransactionalMigration
    {
        /// <inheritdoc />
        protected override void UpWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "GroupId",
                table: "FrameworkUsers",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_FrameworkUsers_GroupId",
                table: "FrameworkUsers",
                column: "GroupId");

            migrationBuilder.AddForeignKey(
                name: "FK_FrameworkUsers_FrameworkGroups_GroupId",
                table: "FrameworkUsers",
                column: "GroupId",
                principalTable: "FrameworkGroups",
                principalColumn: "ID");
        }

        /// <inheritdoc />
        protected override void DownWithTransaction(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_FrameworkUsers_FrameworkGroups_GroupId",
                table: "FrameworkUsers");

            migrationBuilder.DropIndex(
                name: "IX_FrameworkUsers_GroupId",
                table: "FrameworkUsers");

            migrationBuilder.DropColumn(
                name: "GroupId",
                table: "FrameworkUsers");
        }
    }
}
